home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / p063b9s.zip / UNIT / INPUT.PAS < prev    next >
Pascal/Delphi Source File  |  1996-04-20  |  19KB  |  607 lines

  1. UNIT Input;
  2. {╔══════════════════════════════════════════════════════════════════════════╗}
  3. {║ Diverse indtastnings, og sp¢rge-rutiner       Last changed: 20.04.96  SA ║}
  4. {║                                                                          ║}
  5. {║                         (C) Copyright 1989-95 by                         ║}
  6. {║       Dan Wulff, Jens Sandalgaard, Steen Christensen & S¢ren Ager        ║}
  7. {║                                                                          ║}
  8. {║ This source may not be given to anybody, without the written permission  ║}
  9. {║ from The Portal Team.                                                    ║}
  10. {╚══════════════════════════════════════════════════════════════════════════╝}
  11. {$I POPDEFS.INC}
  12.  
  13. INTERFACE
  14.  
  15. USES Use32, Dos, OpEntry, PoPTypes, RBrowser;
  16.  
  17. FUNCTION  GetConfirmAddress(x,y: Byte; VAR Address: TFidoAddress; HelpTopic:WORD): Boolean;
  18. FUNCTION  GetAddress(Line, Col: Byte; VAR Address: TFidoAddress; HelpTopic:WORD): Boolean;
  19. FUNCTION  TestDirectoryPath(VAR Esr: EntryScreen; VAR Path: PathStr; AddBS:BOOLEAN): Boolean;
  20. FUNCTION  SelectFile(VAR FName: String): Boolean;
  21. FUNCTION  InputString(x,y,len,field,col:BYTE; CONST Head, Lead: STRING; VAR s:STRING): Boolean;
  22. FUNCTION  SelectPath(VAR Path: PathStr): Boolean;
  23. FUNCTION  Confirm(CONST s: String; Default: Char; y: Byte): Boolean;
  24. FUNCTION  ConfirmAll(CONST s: String; y: Byte): Char;
  25.  
  26. PROCEDURE MultiSelect(CONST Adr  : TFidoAddress;
  27.                       CONST Head : S40;
  28.                       CONST Lead : S80;
  29.                       CONST Ext  : S3;
  30.                       VAR Buf;
  31.                       Siz        : WORD;
  32.                       VAR SendTo : SendToType;
  33.                       GS         : GetStrFuncType;
  34.                       VAR Esr    : EntryScreenPtr);
  35.  
  36. IMPLEMENTATION
  37.  
  38. USES OpCrt, OpWindow, OpCmd, OpFrame, OpField, OpDir, OpPick, OpEdit,
  39.      OpSelect, OpDos, OpString, OpKey,
  40.      Nodelist, MailUtil, Display, FileUtil, StrUtil, OproUtil,
  41.      Globals, NetFile, KeyBoard, Send2Utl;
  42.  
  43. TYPE
  44.   PDriveList = ^TDriveList;
  45.   TDriveList = ARRAY[1..26] OF Char;
  46.  
  47.   PDrivePickList = ^TDrivePickList;
  48.   TDrivePickList = OBJECT(PickList)
  49.     DriveList : PDriveList;
  50.  
  51.     CONSTRUCTOR Init(ADriveList: PDriveList; NumItems, Choice: Word);
  52.     PROCEDURE ItemString(Item: Word; Mode: pkMode; VAR IType: pkItemType; VAR IString: String); VIRTUAL;
  53.   END;
  54.  
  55.   PPoPPathList = ^TPoPPathList;
  56.   TPoPPathList = OBJECT(PathList)
  57.     Wait : PWait;
  58.  
  59.     CONSTRUCTOR InitCustom(X1, Y1, X2, Y2 : Byte;
  60.                            var AColors : OpCrt.ColorSet;
  61.                            Options : LongInt;
  62.                            HeapToUse : LongInt;
  63.                            PickOrientation : pkGenlProc;
  64.                            CommandInit : paInitCommandProc);
  65.     PROCEDURE paFindPaths(Level: Byte; StartDir: PathStr); VIRTUAL;
  66.   END;
  67.  
  68. VAR
  69.   DL        : DirListPtr;
  70.   FName1    : PathStr;
  71.  
  72.   CONSTRUCTOR TDrivePickList.Init(ADriveList: PDriveList; NumItems, Choice: Word);
  73.   BEGIN
  74.     INHERITED InitAbstract(24, 5, 56, 20, Cfg.Color[2], DefWindowOptions+wBordered, 25, NumItems, PickVertical, SingleChoice);
  75.     SetSearchMode(PickCharSearch);
  76.     IF Cfg.Screen.ExplodingWin THEN EnableExplosions(10);
  77.     wFrame.AddShadow(shBR, shSeeThru);
  78.     wFrame.AddHeader('Disk',heTC);
  79.     SetInitialChoice(Choice);
  80.     DriveList:=ADriveList;
  81.   END;
  82.  
  83.   PROCEDURE TDrivePickList.ItemString(Item: Word; Mode: pkMode; VAR IType: pkItemType; VAR IString: String);
  84. {  VAR
  85.     MediaID : MediaIdType;}
  86.   BEGIN
  87. {    IF GetMediaID(DriveList^[Item], MediaID)=0 THEN}
  88.     IString:=DriveList^[Item]+':   '+GetDiskString(DriveList^[Item]);
  89. {    ELSE
  90.       IString:=DriveList^[Item]+':   Drive not ready';}
  91.     IF Mode=pkDisplay THEN IString:=' '+IString+' ';
  92.   END;
  93.  
  94.  
  95. {=== TPoPPathList ===}
  96.  
  97.   CONSTRUCTOR TPoPPathList.InitCustom(X1, Y1, X2, Y2 : Byte;
  98.                            VAR AColors : OpCrt.ColorSet;
  99.                            Options : LongInt;
  100.                            HeapToUse : LongInt;
  101.                            PickOrientation : pkGenlProc;
  102.                            CommandInit : paInitCommandProc);
  103.   BEGIN
  104.     IF NOT INHERITED InitCustom(X1, Y1, X2, Y2, AColors, Options, HeapToUse,
  105.                                 PickOrientation, CommandInit) THEN Fail;
  106.     Wait:=NIL;
  107.   END;
  108.  
  109.   PROCEDURE TPoPPathList.paFindPaths(Level: Byte; StartDir: PathStr);
  110.   BEGIN
  111.     IF Wait<>NIL THEN Wait^.Animate;
  112.     INHERITED paFindPaths(Level, StartDir);
  113.   END;
  114.  
  115.  
  116. {=== ===}
  117.  
  118.   PROCEDURE MultiSelect(CONST Adr  : TFidoAddress;
  119.                         CONST Head : S40;
  120.                         CONST Lead : S80;
  121.                         CONST Ext  : S3;
  122.                         VAR Buf;
  123.                         Siz        : WORD;
  124.                         VAR SendTo : SendToType;
  125.                         GS         : GetStrFuncType;
  126.                         VAR Esr    : EntryScreenPtr);
  127.   VAR
  128.     w:WindowPtr;
  129.     OldTopic,InKey:WORD;
  130.     Max,y,Top:Integer;
  131.     f : TNetFile;
  132.  
  133.     PROCEDURE WriteLine(y:BYTE; Num:WORD; Current,Toggle:BOOLEAN);
  134.     VAR
  135.       s:STRING;
  136.       Marked:BOOLEAN;
  137.       Cnt:BYTE;
  138.       st:SendToTabType;
  139.     BEGIN
  140.       DEC(Num);
  141.       IF Num<f.FileSize THEN
  142.       BEGIN
  143.         f.GetRec(Buf,Num,NoKeep,Wait);
  144.         ReadSendTo(SendTo,st,Cnt);
  145.         Marked:=IsSendingTo(Adr,St,Cnt);
  146.         IF Toggle THEN
  147.         BEGIN
  148.           IF Marked THEN RemoveFromSendTo(Adr,st,Cnt) ELSE AddToSendTo(Adr,st,Cnt);
  149.           WriteSendTo(st,SendTo,Cnt);
  150.           Marked:=NOT Marked;
  151.           f.PutRec(Buf,Num);
  152.         END;
  153.         s:=GS(Buf, f);
  154.       END ELSE
  155.       BEGIN
  156.         s:='';
  157.         Marked:=FALSE;
  158.         Current:=FALSE;
  159.       END;
  160.       w^.wFastWrite(CPad(s,78),y+1,1,CorrectAttribute(3,Current,Marked));
  161.     END;
  162.  
  163.     PROCEDURE WritePage(Num:WORD);
  164.     VAR
  165.       i:WORD;
  166.     BEGIN
  167.       FOR i:=1 TO ScreenHeight-4 DO
  168.         WriteLine(i,Num+i,FALSE,FALSE);
  169.       Max:=f.FileSize-Top;
  170.       IF Max>ScreenHeight-4 THEN Max:=ScreenHeight-4;
  171.       IF y>Max THEN y:=Max;
  172.     END;
  173.  
  174.     PROCEDURE MoveDown(Num:Integer);
  175.     VAR
  176.      i,OldTop:Integer;
  177.     BEGIN
  178.       OldTop:=Top;
  179.       FOR i:=1 TO Num DO
  180.         IF y<Max THEN INC(y) ELSE
  181.           IF Max+Top<f.FileSize THEN INC(Top);
  182.       IF OldTop<>Top THEN WritePage(Top);
  183.     END;
  184.  
  185.     PROCEDURE MoveUp(Num:Integer);
  186.     VAR
  187.       i,OldTop:Integer;
  188.     BEGIN
  189.       OldTop:=Top;
  190.       FOR i:=1 TO Num DO
  191.         IF y>1 THEN DEC(y) ELSE
  192.           IF Top>0 THEN DEC(Top);
  193.       IF Top<>OldTop THEN WritePage(Top);
  194.     END;
  195.  
  196.   BEGIN
  197.     MyWin(w,1,2,ScreenWidth,ScreenHeight,3,Head,FALSE);
  198.     w^.wFastText(CPad(Lead,78),1,1);
  199.     f.Open(StartPath+'PORTAL.'+Ext,Siz,TRUE);
  200.     IF f.FileSize>0 THEN
  201.     BEGIN
  202.       OldTopic:=Topic;
  203.       Topic:=950;
  204.       y:=1;
  205.       Top:=0;
  206.       WritePage(Top);
  207.       REPEAT
  208.         WriteLine(y,y+Top,TRUE,FALSE);
  209.         InKey:=PoPReadKeyWord;
  210.         WriteLine(y,y+Top,FALSE,FALSE);
  211.         CASE InKey OF
  212.           Home   : BEGIN
  213.                      Top:=0;
  214.                      y:=1;
  215.                      WritePage(Top);
  216.                    END;
  217.           Up     : MoveUp(1);
  218.           PgUp   : MoveUp(ScreenHeight-3);
  219.           Down   : MoveDown(1);
  220.           PgDn   : MoveDown(ScreenHeight-3);
  221.           EndKey : BEGIN
  222.                      Top:=f.FileSize-(ScreenHeight-4);
  223.                      IF Top<0 THEN Top:=0;
  224.                      WritePage(Top);
  225.                      y:=Max;
  226.                    END;
  227.           Enter  : BEGIN
  228.                      WriteLine(y,y+Top,FALSE,TRUE);
  229.                      MoveDown(1);
  230.                    END;
  231.         END;
  232.       UNTIL InKey=Esc;
  233.       Topic:=OldTopic;
  234.     END;
  235.     f.Close;
  236.     KillWindow(w);
  237.     Esr^.SetNextField(Esr^.GetCurrentID);
  238.     Esr^.SetLastCommand(ccNone);
  239.   END;
  240.  
  241.   FUNCTION GetConfirmAddress(x,y: Byte; VAR Address: TFidoAddress; HelpTopic:WORD): Boolean;
  242.   VAR
  243.     Ok,GotIt : Boolean;
  244.     NRec     : NodeListRecType;
  245.     OldTopic : WORD;
  246.     N        : TNodeInfo;
  247.   BEGIN
  248.     OldTopic:=Topic;
  249.     Topic:=HelpTopic;
  250.     REPEAT
  251.       GotIt:=GetAddress(x,y,Address,Topic);
  252.       RemapAddress(Address);
  253.       IF GotIt THEN
  254.         IF FindNode(Address,NRec) THEN
  255.         BEGIN
  256.           Ok:=Confirm('Node is: "'+NRec.SystemName+'", correct?','Y',12);
  257.         END ELSE
  258.         BEGIN
  259.           Ok:=FindNodeInfo(N,Address);
  260.           IF NOT ok THEN
  261.             Ok:=Confirm('Node : '+Address2Str(Address)+' is unknown, ok?','Y',12);
  262.         END;
  263.     UNTIL Not GotIt or Ok;
  264.     Topic:=OldTopic;
  265.     GetConfirmAddress:=GotIt;
  266.   END;
  267.  
  268.   FUNCTION GetAddress(Line, Col: Byte; VAR Address: TFidoAddress; HelpTopic:WORD): Boolean;
  269.   VAR
  270.     ESr  : TPoPEntryScreen;
  271.     OldTopic:WORD;
  272.   BEGIN
  273.     OldTopic:=Topic;
  274.     WITH Esr, Address DO
  275.     BEGIN
  276.       Esr.Init(33, Line+1, 46, line+4, Col, 'Node');
  277. {$IFDEF OS2}
  278.       addsmallintfield('Zone :',1,2,'#####',1,9,HelpTopic,0,0,Zone);
  279.       addsmallintfield('Net  :',2,2,'#####',2,9,HelpTopic,0,0,Net);
  280.       addsmallintfield('Node :',3,2,'#####',3,9,HelpTopic,0,0,Node);
  281.       addsmallintfield('Point:',4,2,'#####',4,9,HelpTopic,0,0,Point);
  282. {$ELSE}
  283.       addintfield('Zone :',1,2,'#####',1,9,HelpTopic,0,0,Zone);
  284.       addintfield('Net  :',2,2,'#####',2,9,HelpTopic,0,0,Net);
  285.       addintfield('Node :',3,2,'#####',3,9,HelpTopic,0,0,Node);
  286.       addintfield('Point:',4,2,'#####',4,9,HelpTopic,0,0,Point);
  287. {$ENDIF}
  288.       SetNextField(2);
  289.       REPEAT
  290.         Process;
  291.       UNTIL (GetLastCommand=ccQuit) Or Not CmpAdr(Address,Cfg.Addresses[Cfg.MainAdrNum]);
  292.       GetAddress:=(ESR.GetLastCommand<>ccQuit);
  293.     END;
  294.     Esr.Done;
  295.     Topic:=OldTopic;
  296.   END;
  297.  
  298.   FUNCTION TestDirectoryPath(VAR Esr: EntryScreen; VAR Path: PathStr; AddBS:BOOLEAN): Boolean;
  299.   VAR
  300.     Save : Boolean;
  301.     Dir  : PathStr;
  302.   BEGIN
  303.     Save:=False;
  304.     IF (Esr.GetLastCommand=ccUser2) AND SelectPath(Path) THEN Save:=True;
  305.     IF (Path<>'') THEN
  306.     BEGIN
  307.       IF Copy(Path,2,1)<>':' THEN
  308.       BEGIN
  309.         GetDir(0, Dir);
  310.         IF Copy(Path, 1, 1)='\' THEN Path:=Copy(Dir, 1, 2)+Path ELSE Path:=Dir+'\'+Path;
  311.         Esr.DrawField(Esr.GetCurrentID);
  312.       END;
  313.       IF NOT ChkDir(Path) THEN
  314.         IF (Confirm('Directory does not exist, create it?','Y',11)) THEN
  315.         BEGIN
  316.           Save:=True;
  317.           MakeFullDir(Path);
  318.         END ELSE
  319.         BEGIN
  320.           Esr.SetNextField(Esr.GetCurrentID);
  321.           Esr.SetLastCommand(ccNone);
  322.         END;
  323.       IF (AddBS OR ((Length(Path)=2) AND (Path[2]=':'))) THEN
  324.       BEGIN
  325.         IF (Path[Length(Path)]<>'\') THEN
  326.         BEGIN
  327.           Path:=Path+'\';
  328.           Esr.DrawField(Esr.GetCurrentID);
  329.           Save:=True;
  330.         END;
  331.       END ELSE
  332.       BEGIN
  333.         IF (Length(Path)>3) THEN
  334.         BEGIN
  335.           IF (Path[Length(Path)]='\') THEN
  336.           BEGIN
  337.             Dec(Path[0]);
  338.             Esr.DrawField(Esr.GetCurrentID);
  339.             Save:=True;
  340.           END;
  341.         END;
  342.       END;
  343.     END;
  344.     TestDirectoryPath:=Save;
  345.   END;
  346.  
  347.   FUNCTION InputString(x, y, Len, Field, Col: Byte; CONST Head, Lead: STRING; VAR s: STRING): Boolean;
  348.   VAR
  349.     le:LineEditor;
  350.     temp:WindowPtr;
  351.   BEGIN
  352.     WITH le DO
  353.     BEGIN
  354.       mywin(Temp,x,y,x+field+4+Length(lead),y+2,col,Head,True);
  355.       WITH le DO
  356.       BEGIN
  357.         Init(Cfg.Color[col]);
  358.         leEditOptionsOff(leTrimBlanks);
  359.         ReadString(Lead, y+1,x+2+(ScreenWidth-80) DIV 2, len, field, s);
  360.         TrimTrail(s);
  361.         InputString:=NOT (GetLastCommand=ccQuit);
  362.         Done;
  363.       END;
  364.       KillWindow(Temp);
  365.     END;
  366.   END;
  367.  
  368.   procedure PreEdit(ESP : EntryScreenPtr); far;
  369.     {-Called just before a field is edited}
  370.   begin
  371.     with ESP^ do
  372.       if GetCurrentID = 1 then
  373.         if DL^.GetMatchingFileCount = 0 then
  374.           SetNextField(0);
  375.   end;
  376.  
  377.   procedure PostEdit(ESP : EntryScreenPtr); far;
  378.  
  379.     function AcceptFile(var S : string) : Boolean;
  380.     begin
  381.       S:=FExpand(S);
  382.       if (S[Length(S)] = '\') or IsDirectory(S) then
  383.       begin
  384.         S:=AddBackSlash(S)+'*.*';
  385.         AcceptFile := False;
  386.       end else
  387.         AcceptFile:=(ExistFile(S) And (Pos('*',s)=0) And (Pos('?',s)=0));
  388.     end;
  389.  
  390.   begin
  391.     with ESP^ do
  392.       case GetCurrentID of
  393.         0 : if (GetLastCommand = ccSelect) and AcceptFile(FName1) then
  394.               SetLastCommand(ccDone)
  395.             else
  396.               if CurrentFieldModified then
  397.               begin
  398.                 DL^.SetMask(FExpand(FName1), AnyFile);
  399.                 ChDir(JustPathName(FName1));
  400.                 DL^.PreLoadDirList;
  401.                 Draw;
  402.               end;
  403.         1 : if GetLastCommand = ccSelect then
  404.             begin
  405.               FName1 := DL^.GetSelectedPath;
  406.               ChDir(JustPathName(FName1));
  407.               DrawField(0);
  408.             end;
  409.       end;
  410.   end;
  411.  
  412.   FUNCTION SelectFile(VAR FName: String): Boolean;
  413.   var
  414.     ES      : EntryScreen;
  415.     Status  : Word;
  416.     AllDone : Boolean;
  417.     CurDir  : PathStr;
  418.  
  419.     function InitEntryScreen : Word;
  420.     const
  421.       WinOptions = wBordered+wClear+wUserContents;
  422.     begin
  423.       with ES do
  424.       begin
  425.         if not InitCustom(6, 6, 74, 21, Cfg.Color[3], WinOptions) then
  426.         begin
  427.           InitEntryScreen := $ffff;
  428.           Exit;
  429.         end;
  430.  
  431.         wFrame.AddShadow(shBR, shSeeThru);
  432.         SetWrapMode(WrapAtEdges);
  433.         SetPreEditProc(PreEdit);
  434.         SetPostEditProc(PostEdit);
  435.         esFieldOptionsOn(efClearFirstChar);
  436.         AddSimpleStringField('File:', 1, 3, 'X', 1, 9, 50, 64, 1, FName1);
  437.         esFieldOptionsOff(efAllowEscape);
  438.         esSecFieldOptionsOn(sefSwitchCommands);
  439.         AddWindowField('', 2, 3, 2, 3, 2, DL^);
  440.         InitEntryScreen := RawError;
  441.       end;
  442.     end;
  443.  
  444.     function InitDirList : Word;
  445.     const
  446.       WinOptions = wBordered+wAltFrame+wClear+wUserContents+wNoCoversBuffer;
  447.     begin
  448.       New(DL, InitCustom(9, 8, 71, 20, Cfg.Color[3], WinOptions, MaxAvail-8192, PickHorizontal, SingleFile));
  449.       if DL=NIL then
  450.       begin
  451.         InitDirList := $ffff;
  452.         Exit;
  453.       end;
  454.  
  455.       with DL^ do
  456.       begin
  457.         DL^.AddMaskHeader(True, 1, Width, heTC);
  458.         DL^.AddMoreHeader(' || ', heBR, #25, #24, '', 2, 3, 0);
  459.   {     aFrame.SetFrameAttr($1B, $07);}
  460.         SetPadSize(1,1);
  461.         SetSortOrder(SortDirName);
  462.         diOptionsOn(diShowDrives+diExitIfOne+diSetFirstFile);
  463.         SetNameSizeKFormat('<dir>');
  464.         SetSearchMode(PickStringSearch);
  465.         SetDriveDelim('[',':\]');
  466.         SetMask(FName1, AnyFile);
  467.         PreLoadDirList;
  468.         InitDirList:=RawError;
  469.       end;
  470.     end;
  471.  
  472.   begin
  473.     SelectFile:=False;
  474.     GetDir(0, CurDir);
  475.     FName1:=FExpand(FName);
  476.  
  477.     Status:=InitDirList;
  478.     if Status <> 0 then
  479.     begin
  480.       WriteLn('Error initializing DirList: ', Status);
  481.       Exit;
  482.     end;
  483.  
  484.     Status := InitEntryScreen;
  485.     if Status <> 0 then
  486.     begin
  487.       WriteLn('Error initializing entry screen: ', Status);
  488.       Exit;
  489.     end;
  490.  
  491.     AllDone := False;
  492.     repeat
  493.       ES.Process;
  494.       case ES.GetLastCommand of
  495.         ccDone  : AllDone := True;
  496.         ccError,
  497.         ccQuit  : begin
  498.                     AllDone := True;
  499.                     FName1 := '';
  500.                   end;
  501.       end;
  502.     until AllDone;
  503.  
  504.     ES.Erase;
  505.  
  506.     SelectFile:=ES.GetlastCommand<>ccQuit ;
  507.     IF ES.GetLastCommand<>ccQuit THEN FName:=FName1;
  508.     ES.Done;
  509.     ChangeDir(CurDir);
  510.   end;
  511.  
  512.  
  513.   FUNCTION SelectDrive(VAR InDrive: Char): Boolean;
  514.   VAR
  515.     DriveList : TDriveList;
  516.     PL        : TDrivePickList;
  517.     i, ii     : Word;
  518.     Drive     : Char;
  519.   BEGIN
  520.     FillChar(DriveList, SizeOf(DriveList), 0);
  521.     i:=1; ii:=1;
  522.     FOR Drive:='A' TO 'Z' DO
  523.       IF ValidDrive(Drive) THEN
  524.       BEGIN
  525.         DriveList[i]:=Drive;
  526.         IF InDrive=Drive THEN ii:=i;
  527.         Inc(i);
  528.       END;
  529.     PL.Init(@DriveList, Pred(i), ii);
  530.     PL.Process;
  531.     PL.Erase;
  532.     IF PL.GetLastCommand=ccSelect THEN InDrive:=DriveList[PL.GetLastChoice]
  533.                                   ELSE InDrive:=DefaultDrive;
  534.     SelectDrive:=(PL.GetLastCommand=ccSelect);
  535.     PL.Done;
  536.   END;
  537.  
  538.   FUNCTION SelectPath(VAR Path: PathStr): Boolean;
  539.   VAR
  540.     TmpPath : PathStr;
  541.     PL : TPoPPathList;
  542.     Drive : Char;
  543.     Win : WindowPtr;
  544.   BEGIN
  545.     WITH PL DO
  546.     BEGIN
  547.       IF Not InitCustom(25,4,55,19,Cfg.Color[3],DefWindowOptions+wBordered,
  548.                         MaxAvail-1024, PickVertical, SinglePath) THEN
  549.       BEGIN
  550.         SelectPath:=False;
  551.       END;
  552.       IF Cfg.Screen.ExplodingWin THEN EnableExplosions(10);
  553.       wFrame.Addheader(' Select Directory ',heTC);
  554.       wFrame.AddShadow(shBR, shSeeThru);
  555.       paOptionsOn(paAltCurDir+paUpcase+paOptimizeSize+paSetCurDir);
  556.       SetPadSize(1,1);
  557.       IF ((Length(Path)>0)) And (ValidDrive(Path[1])) THEN
  558.         Drive:=Path[1] ELSE Drive:=DefaultDrive;
  559.       IF SelectDrive(Drive) THEN
  560.       BEGIN
  561.          New(Wait, Init((ScreenHeight DIV 2)-2, 1, 'Scanning drive '+Drive+':'));
  562.          SetDrive(Drive);
  563.          PreloadPathList;
  564.          TmpPath:=GetPathName(Drive);
  565.          Dispose(Wait, Done); Wait:=NIL;
  566.       END ELSE
  567.         TmpPath:='';
  568.       IF TmpPath<>'' THEN
  569.       BEGIN
  570.         Path:=TmpPath;
  571.         SelectPath:=(GetLastCommand=ccSelect);
  572.       END ELSE
  573.         SelectPath:=False;
  574.       Done;
  575.     END;
  576.   END;
  577.  
  578.   FUNCTION Confirm(CONST s: String; Default: Char; y: Byte): Boolean;
  579.   VAR
  580.     x          : Byte;
  581.     ConfirmWin : WindowPtr;
  582.     LE         : LineEditor;
  583.   BEGIN
  584.     x:=38-(Length(s) DIV 2);
  585.     mywin(ConfirmWin,x-2,y,x+7+Length(s),y+2,3,'Confirm',True);
  586.     LE.Init(Cfg.Color[3]);
  587.     Confirm:=LE.YesOrNo(s,y+1,x+((ScreenWidth-80) DIV 2),default);
  588.     KillWindow(ConfirmWin);
  589.   END;
  590.  
  591.   FUNCTION ConfirmAll(CONST s: String; y: Byte): Char;
  592.   VAR
  593.     x          : Byte;
  594.     ConfirmWin : WindowPtr;
  595.     LE         : LineEditor;
  596.     Ch         : Char;
  597.   BEGIN
  598.     x:=38-((Length(s)+8) DIV 2);
  599.     mywin(ConfirmWin,x-2,y,x+10+Length(s),y+2,3,'Confirm',True);
  600.     LE.Init(Cfg.Color[3]);
  601.     LE.ReadChar(s+' (y/n/a) ', y+1,x+((ScreenWidth-80) DIV 2), ['Y','y','N','n','A','a'], Ch);
  602.     ConfirmAll:=UpCase(Ch);
  603.     KillWindow(ConfirmWin);
  604.   END;
  605.  
  606. END.
  607.